<template>
	<view class="bg_fff">
		<view class="cu-list menu-avatar comment solids-top">
			<view class="cu-item">
				<view class="cu-avatar round cuIcon-peoplefill"></view>
				<view class="content">
					<view class="text-grey">{{data.djr_xm}}</view>
					<!-- <view class="text-gray text-content text-df">
						农场  XXX管理区  XX地块
					</view> -->
					<view class="bg-grey padding-sm radius margin-top-sm  text-sm">
						<view class="flex">
							<view class="flex-sub">{{data.wt_nr}}</view>
						</view>
					</view>
					<view class="margin-top-sm flex justify-between">
						<view class="text-gray text-df cuIcon-locationfill font-size-min">{{data.wt_dqwz}}</view>
					</view>
					<view class=" flex justify-between">
						<view class="text-gray text-df">{{data.wt_djsj}}</view>
						<view>
							<text class="cuIcon-messagefill text-gray margin-left-sm">{{data.wt_dasl}}</text>
						</view>
					</view>
				</view>
				
			</view>
			<view class="padding20">
					<textarea class="border"  v-model="hdtext" placeholder="请输入您的回答"></textarea>
					<button class="cu-btn block bg-blue margin-tb-sm lg" @tap="commentClick">提交回答</button>
			</view>
		</view>
		<scroll-view scroll-y class="scroll-view-item_H font-size-mid">
			<view class="cu-timeline">
				<view class="cu-item" v-for="(item,index) in data.hf" :key='index'>
					<view class="content">
						<text>{{item.djr_xm}} :{{' '}}</text> {{item.hf_nr}}
					</view>
				</view>
			</view>
		</scroll-view>
	
	</view>
</template>

<script>
		import {getwtlist,getwthflr} from '../api/api.js'
	export default {
		data() {
			return {
				 myText:'',  
				 hdtext:'',
				setFocus:false,
				 wt_bh:'',
				 data:{}
			}
		},
		onLoad: function (option) {
			this.wt_bh=option.wt_bh ;
			let parm={cx_wtbh:this.wt_bh}
			getwtlist(parm,
			res=>{
				this.data=res.data.returnData.wtxxlb[0]
			})
			
		},
		methods:{
			commentClick(){  
				if(this.hdtext){
				
					var useIDnameid = uni.getStorageSync('useIDnameid');
					var useIDname = uni.getStorageSync('useIDname');
					let parm={hf_wtbh:this.wt_bh,hf_nr:this.hdtext,djr_bh:useIDnameid,djr_xm:useIDname}
					getwthflr(parm,
					res=>{
						console.log(res)
						if(res.data.returnData.code=='200'){
							uni.showModal({
							    title: '提示',
							    content: '回复成功',
								showCancel:false
							});
							this.hdtext='';
							let parm={cx_wtbh:this.wt_bh}
							getwtlist(parm,
							res=>{
								this.data=res.data.returnData.wtxxlb[0]
							})
						}else{
							uni.showModal({
							    title: '提示',
							    content: red.data.returnData.msg,
								showCancel:false
							});
						}
					}) 
				}else{
					uni.showModal({
					    title: '提示',
					    content: '请输入回复内容',
						showCancel:false
					});
				}
				
			}, 
		}
		
	}
			
</script>

<style>
	@import "../../colorui/main.css";
	@import "../../colorui/icon.css"; 
	.scroll-view-item_H{
	      max-height: 1200upx;
	}
	.font-size-min{
		font-size: 24upx;
	}
	.font-size-mid{
		font-size: 30upx;
	}
	.padding20{
		padding:20upx 60upx;
	}
	.border{
		border: 1px solid #ccc;
		line-height: 60upx;
		height: 180upx;
		width: 100%;
		border-radius:10upx ;
	}
</style>

